﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Media.Imaging;
using Dominion.WPF.Properties;
using System.IO;
using System.Drawing.Imaging;

namespace Dominion.WPF.Converters
{
    internal class ConvertersHelper
    {
        private static global::System.Resources.ResourceManager resourceMan =
           new global::System.Resources.ResourceManager("Dominion.WPF.Properties.Resources", typeof(Resources).Assembly);


        internal static BitmapImage ImageFromName(string name)
        {
            Bitmap bitmap = (Bitmap)resourceMan.GetObject(name);
            BitmapImage bi;
            MemoryStream ms = new MemoryStream();

            bitmap.Save(ms, ImageFormat.Bmp);
            ms.Position = 0;
            bi = new BitmapImage();
            bi.BeginInit();
            bi.StreamSource = ms;
            bi.EndInit();

            return bi;

        }
    }
}
